import os
import sys

def setup_project():
    """初始化项目结构"""
    # 获取项目根目录
    base_dir = os.path.abspath(os.path.dirname(__file__))
    
    # 创建必要的目录
    directories = [
        'instance',
        'uploads',
        'uploads/services',
        'uploads/carousel',
        'uploads/images'
    ]
    
    for directory in directories:
        dir_path = os.path.join(base_dir, directory)
        os.makedirs(dir_path, exist_ok=True)
        print(f'Created directory: {dir_path}')
    
    # 创建 .gitignore 文件
    gitignore_content = """
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# Flask
instance/
.webassets-cache

# Uploads
uploads/

# Database
*.db
*.sqlite

# Environment variables
.env
.venv
venv/
ENV/
"""
    
    with open(os.path.join(base_dir, '.gitignore'), 'w') as f:
        f.write(gitignore_content.strip())
    print('Created .gitignore file')
    
    print('Project setup completed successfully!')

if __name__ == '__main__':
    setup_project() 